package com.newbb;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import com.newbb.entity.Student;
import com.newbb.services.DatabaseService;
 
import java.io.Serializable;
import java.util.Date;
 
@ManagedBean
@RequestScoped
public class HelloBean implements Serializable {
 
	private static final long serialVersionUID = 1L;
 
	private Student student = new Student();
	
	private DatabaseService dbService = new DatabaseService();
 	
	public void add(){
		System.out.println("gfgg");
		student.setFirstName("Adrian");		
		student.setHireDate(new Date());
		dbService.addStudent(student);
	}
	
	public String getName() {
		System.out.println("gfgg");
		student.setFirstName("Adrian");		
		student.setHireDate(new Date());
		dbService.addStudent(student);
		return student.getLastName();
	}
	
	public void setName(String name){
		this.student.setLastName(name);
	}
 
	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}
}